package com.web.service.impl;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.web.dao.TCathecticDao;
import com.web.model.TCathectic;
import com.web.model.UserAmt;
import com.web.service.TCathecticService;
import com.web.model.PageBean;
import com.web.utils.Pager;

/**
 * 投注信息 Service实现
 * 
 * @author wzy
 * 
 */
@Service
public class TCathecticServiceImpl implements TCathecticService {

	// protected Log log = LogFactory.getLog(getClass());
	@Autowired
	private TCathecticDao cathecticDao;// 注入TCathectic的dao


	public int insert(TCathectic cathectic) {
		return cathecticDao.insert(cathectic);
	}

	
	public int deleteByPrimaryKey(Long cathecticId) {
		return cathecticDao.deleteByPrimaryKey(cathecticId);
	}

	
	public int updateByPrimaryKey(TCathectic cathectic) {
		return cathecticDao.updateByPrimaryKey(cathectic);
	}

	
	public TCathectic selectByPrimaryKey(Long cathecticId) {
		return cathecticDao.selectByPrimaryKey(cathecticId);
	}

	
	public List<TCathectic> selectList(Map<String, Object> map) {
		return cathecticDao.selectList(map);
	}

	
	public PageBean<TCathectic> selectListByPage(Map<String, Object> map) {
		Pager.addPage(map);
		Integer count = cathecticDao.selectListCount(map);
		List<TCathectic> list = cathecticDao.selectList(map);
		PageBean<TCathectic> pageList = new PageBean<TCathectic>(list);
		pageList.setTotal(count);
		pageList.setList(list);
		pageList.setPageNum((Integer) map.get("pageNum"));
		pageList.setPageSize((Integer) map.get("pageSize"));
		pageList.setPages(Pager.getPages(count, (Integer) map.get("pageSize")));
		return pageList;
	}

	
	public TCathectic selectByModelSelective(TCathectic cathectic) {
		return cathecticDao.selectByModelSelective(cathectic);
	}

	
	@Transactional
	public void insertList(List<TCathectic> insertCathecticList) {
		cathecticDao.insertList(insertCathecticList);
	}

	
	public int selectListCount(Map<String, Object> map) {
		return cathecticDao.selectListCount(map);
	}

	
	public void updateLoseCathectic(long termcd) {
		cathecticDao.updateLoseCathectic(termcd);
	}

	
	public List<TCathectic> selectCatheticByDay(Map<String, Object> map) {
		return cathecticDao.selectCatheticByDay(map);
	}

	
	public PageBean<TCathectic> selectCatheticPageByDay(Map<String, Object> map) {
		Pager.addPage(map);
		Integer count = cathecticDao.selectCatheticListByDayCount(map);
		List<TCathectic> list = cathecticDao.selectCatheticListByDay(map);
		PageBean<TCathectic> pageList = new PageBean<TCathectic>(list);
		pageList.setTotal(count);
		pageList.setList(list);
		pageList.setPageNum((Integer) map.get("pageNum"));
		pageList.setPageSize((Integer) map.get("pageSize"));
		pageList.setPages(Pager.getPages(count, (Integer) map.get("pageSize")));
		return pageList;
	}

	
	public Double selectTodayWin(Map<String, Object> map) {
		return cathecticDao.selectTodayWin(map);
	}

	
	public List<TCathectic> selectCatheticByMonth(Map<String, Object> map) {
		return cathecticDao.selectCatheticByMonth(map);
	}

	
	public List<UserAmt> findUserAmtList(UserAmt amt) {
		return cathecticDao.findUserAmtList(amt);
	}

}
